POV-Ray : Newsgroups : povray.binaries.images : my very first iso-surface (and second macro) :-) : my very first iso-surface (and second macro) :-) Server Time
7 Nov 2024 09:29:48 EST (-0500)
  my very first iso-surface (and second macro) :-)  
From: Jaap
Date: 4 Sep 2004 03:45:00
Message: <web.4139722b2521c5a8399d8d0@news.povray.org>
my very first iso-surface (and second macro) :-)
the thread is a single iso-surface, bold heads and nuts are CSG.

shown:
 M3 x 25
 M6 x 50
 M10 x 30
 M16 x 50
 M64 x 150

#macro thread_macro( thrOD, totalLen, solidLen, thrSpoed )
  // thrOD   : outer diameter, before "cutting" the thread.
  // totalLen: result: <0,0,0> to <0,0,-totalLen>
  // solidLen: <0,0,0> to <0,0,-solidLen> is not threaded.
  // thrSpoed: displacement per revolution (spoed) (=25.4/tpi)
  #declare thrAngle = 60;    // (degrees)
  #declare chamOut  =  0.05; // chamfer outside (part of threadDepts)
  #declare thrRad   = 0.5*thrOD;
  #declare thrs     = 1/thrSpoed;
  #declare thrDepts = 0.5*thrSpoed/tan(radians(thrAngle)*0.5);
  isosurface {
    function{ max(
      sqrt(pow(x,2)+pow(y,2))-thrRad + // cilinder
      max( min(thrDepts*max(chamOut,   // chamfered threads
      abs(mod(2+z*thrs*2+atan2(x,y)/pi,2)-1)), // threads
      max((z-solidLen)*0.25, 0)),      // = sollid part
      thrDepts+z-totalLen)             // = chamfered end
      ,2*thrOD-sqrt(pow(x,2)+pow(y,2)+
      pow(totalLen+thrOD*1.965-z,2)) )}// = dimple in end
    max_gradient 2.0
    accuracy thrOD/1000
    contained_by{box{<-thrRad,-thrRad,0>,<thrRad,thrRad,totalLen>}}
    scale <1,1,-1>
  }
#end

jaap.


Post a reply to this message


Attachments:
Download 'parts3.png' (158 KB)

Preview of image 'parts3.png'
parts3.png


 

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.